import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    redirect: '/home',  // 重定向:重新指向其它path,会改变网址
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/home/shou',
        name: 'Shou',
        component: () => import( '../views/home/Shou.vue')
      },
      {
        path: '/home/shop',
        name: 'Shop',
        component: () => import( '../views/home/Shop.vue')
      },
      {
        path: '/home/my',
        name: 'My',
        component: () => import( '../views/home/My.vue')
      },
    ]
  },
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
